#pragma once
/* Copyright (C) 2009 Vlad Roubtsov. All rights reserved. */

#include <fstream>
using std::ifstream;
using std::ofstream;
#include <istream>
#include <ostream>
using std::ios;
using std::ios_base;
using std::istream;
using std::ostream;
#include <sstream>
#include <string>

#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;

#include <boost/shared_array.hpp>

#include "vr/util/types.hpp"

//----------------------------------------------------------------------------
namespace vr
{
namespace files
{

inline void
read_fully (std::istream & in, std::ostream & out) // TODO better impl
{
    using std::string;

//    const int32_t buf_size = (16 * 1024) / sizeof (int64_t);
//    boost::shared_array<int64_t> buf (new int64_t [buf_size]);

    string line;
    while (std::getline (in, line))
    {
        out.write (line.c_str (), line.size());
        out.put ('\n');
    }
}

inline std::string
read_fully (std::istream & in)
{
    using std::string;
    std::ostringstream buf;

    read_fully (in, buf);
    buf.flush ();

    return buf.str ();
}

} // end of 'files'
} // end of namespace
//----------------------------------------------------------------------------
